{% extends 'base2.html' %}

{% block db_book %}
    <!-- 新增出版社：按钮 -->
    <div class="book-head">
        <span class="btn btn-info btn-lg pull-right iconfont" data-toggle="modal"
              data-target=".modal-pub">&#xe6a1;
        </span>
    </div>
    <!-- 新增出版社：模态框 -->
    <div class="modal fade modal-pub" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
        <div class="modal-dialog modal-sm" role="document">
            <div class="modal-content">
                <form class="form-horizontal" action="" method="post">
                    {% csrf_token %}
                    <div class="form-group">
                        <div class="col-md-offset-1 col-md-10" style="margin-top: 30px;">
                            {{ form.pub_name }}
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-offset-1 col-md-10" style="margin-bottom: 10px">
                            <button type="submit" class="btn btn-info btn-block iconfont">&#xe6a1;</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!-- 遍历 -->
    {% for pub in pub_list %}
        <div class="col-md-3 pub-auth">
            <!-- 出版社超链接 -->
            <div class="pub-bg bg">
                <a class="text-muted text-center center-block" href="/app_home/{{ pub.pk }}/pub_info/"></a>
            </div>
            <span class="text-center center-block small">{{ pub.pub_name }}</span>
            <div>
                <!-- 删除 -->
                <a href="/app_home/{{ pub.pk }}/delete_pub" style="margin-right: 20px" class="btn btn-info btn-sm
            pull-right iconfont">&#xe88a;</a>
                <!-- 修改：按钮 -->
                <span class="btn btn-info btn-sm pull-left iconfont" style="margin-left: 20px" data-toggle="modal"
                      data-target="#modal{{ pub.pk }}">&#xe606;</span>
                <!-- 修改：模态框 -->
                <div class="modal fade" id="modal{{ pub.pk }}" tabindex="-1" role="dialog"
                     aria-labelledby="mySmallModalLabel">
                    <div class="modal-dialog modal-sm" role="document">
                        <div class="modal-content">
                            <form class="form-horizontal" action="" method="post">
                                {% csrf_token %}
                                <div class="form-group">
                                    <div class="col-md-offset-1 col-md-10" style="margin-top: 30px">
                                        <!-- 修改前 -->
                                        <input class="form-control" name="{{ pub.pk }}auth_name"
                                               value="{{ pub.pub_name }}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-offset-1 col-md-10" style="margin-bottom: 10px">
                                        <!-- home.js -->
                                        <span class="btn btn-info btn-block change_pub">确认修改</span>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}
    <div class="page-nav">
        <nav>
            <ul class="pagination">
                {{ pager.page_html|safe }}
            </ul>
        </nav>
    </div>
{% endblock %}